package com.example.villagemanager.ui.activity;

import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.viewpager.widget.ViewPager;
import butterknife.BindView;

import android.os.Bundle;

import com.example.villagemanager.R;
import com.example.villagemanager.config.Constant;
import com.example.villagemanager.listener.OnItemClickListener;
import com.example.villagemanager.model.bean.ListViewAdapterBean;
import com.example.villagemanager.model.event.Event;
import com.example.villagemanager.ui.adapter.FmPagerAdapter;
import com.example.villagemanager.ui.adapter.ListViewAdapter;
import com.example.villagemanager.ui.base.BaseActivity;
import com.example.villagemanager.ui.fragment.setting.AccountSettingFragment;
import com.example.villagemanager.ui.fragment.setting.BaseInfoFragment;
import com.example.villagemanager.ui.fragment.setting.BlueToothSettingFragment;

import java.util.ArrayList;
import java.util.List;

public class SystemSettingActivity extends BaseActivity {
    @BindView(R.id.recycle_view)
    RecyclerView recyclerView;
    @BindView(R.id.view_pager)
    ViewPager viewPager;
    List<ListViewAdapterBean> beanList=new ArrayList<>();
    ListViewAdapter adapter;
    private ArrayList<Fragment> fragments = new ArrayList<>();
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    protected void initActivityData() {



    }

    @Override
    protected void initContentView() {
        BaseInfoFragment baseInfoFragment=new BaseInfoFragment();
        AccountSettingFragment accountSettingFragment=new AccountSettingFragment();
        BlueToothSettingFragment blueToothSettingFragment=new BlueToothSettingFragment();
        fragments.add(baseInfoFragment);
        fragments.add(accountSettingFragment);
        fragments.add(blueToothSettingFragment);
        viewPager.setAdapter(new FmPagerAdapter(fragments,getSupportFragmentManager()));
        for(String data: Constant.setting_data){
            ListViewAdapterBean bean=new ListViewAdapterBean();
            bean.setData1(data);
            beanList.add(bean);
        }
        recyclerView.setLayoutManager(new LinearLayoutManager(this));
        adapter=new ListViewAdapter(this,beanList);
        recyclerView.setAdapter(adapter);
        adapter.setmOnItemClickListener(new OnItemClickListener() {
            @Override
            public void onItemClick(int position) {
                viewPager.setCurrentItem(position);
            }
        });


    }
    @Override
    protected int getContentView() {
        return R.layout.activity_system_setting;
    }

    @Override
    protected void onEventProcess(Event event) {

    }
}
